<template>
  <Dialog :appDialog="appDialog">
    <div class="content">当一个客户含有多个待办任务时，待办执行规则如下：</div>
    <el-radio v-model="type" :label="1">已逾期+当前待处理的待办任务</el-radio><el-radio v-model="type" :label="2">当前待处理的待办任务</el-radio>
  </Dialog>
</template>
<script lang="ts" setup>
  import { ref, reactive, watch } from 'vue'
  import Dialog from '@/components/Dialog.vue'
  import { heightSet, heightGet } from '@/api/smartMarketing/marketAutomation/friendCircleSop'
  import { ElMessage } from 'element-plus'
  const time = ref('')
  const type = ref(1)
  const cancelHandel = () => {
    appDialog.visible = false
  }
  const submitHandel = () => {
    heightSet({ type: type.value })
      .then((res: any) => {
        appDialog.visible = false
        ElMessage.success('设置成功')
      })
      .catch((e: any) => {
        ElMessage.error('设置失败')
      })
  }
  const appDialog = reactive({
    visible: false,
    title: '高级设置',
    width: '600px',
    cancel: cancelHandel,
    submit: submitHandel,
    cancelText: '取消',
    submitText: '确定'
  })

  // 获取设置提醒数据
  const getSetData = () => {
    heightGet().then((res: any) => {
      type.value = res.type
    })
  }
  watch(
    () => appDialog.visible,
    (val) => {
      if (val) {
        getSetData()
      }
    }
  )
  defineExpose({ appDialog })
</script>
<style lang="scss" scoped>
  .content {
    padding-bottom: 20px;
  }
</style>
